-
Notifications
You must be signed in to change notification settings - Fork 199
Do not add -sysroot flag when ANDROID_NDK_ROOT environment is set #1879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I've marked this ready for review, @jakepetroules, @finagolfin, and @compnerd. See also the discussion at swiftlang/swift-build#495 (comment) |
I agree with getting rid of this. As much as the idea is to automatically set things up and make things automatically work, I think it's better to have the user configure this themselves. For example, this env variable is automatically set on the github CI, so even if the user explicitly configures the Better to not have such magic and make the setup more explicit, as it would be after this pull. |
This is going to break all of our builds, please do not commit this as is. We need the ability to be able to pass the |
Then how about gating it within an |
This change isn't removing the ability to do that, right? It's just removing the default fallback. From what I understand, explicitly passing |
@compnerd Any thoughts on either @jakepetroules's questions or my suggestion? I'd really like to reach some solution so we can un-block the Android SDK work. |
Ah, right; this still will break our builds as we do rely on the default. Can we wire up the default through swift-build before we remove this? |
When the environment
ANDROID_NDK_ROOT
is set, the driver manually adds it as a--sysroot
flag. This breaks building with an Android SDK when this variable is set, with confusing errors. I first saw this at finagolfin/swift-android-sdk#207 (comment), and more recently ran into it again (https://github.com/swift-android-sdk/swift-docker/actions/runs/14584558227/job/40907674425) while working on the official Android SDK build script, where it fails a build with:In both cases, manually un-setting
ANDROID_NDK_ROOT
(which is set by default in GitHub workflows) resolved the issue.This flag has some history (#1560, #1681, and #1811), but I feel like it should just be excised altogether since the Android SDK can specify its own
sdkRootPath
in theswift-sdk.json
file. If Windows needs it due to lack of Swift SDK support, then it could be gated inside an#if os(Windows)
check.And BTW, the
#if arch(x86_64)
check is incorrect: the Android NDK works on both Intel and ARM macOS machines, despite being stored under "darwin-x86_64", as the binaries are universal: